package com.glsc.ngateway.common.base.domain.mysql.gateway.other;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.util.Objects;

/**
 * @author zhouzp
 * @date 2020/5/29
 * 产品干系人，如总负责人、投资经办、市场经理、市场经办、承揽人，以及部门信息如承揽部门、规模归属部门、收入归属部门
 */
@Data
@ToString(callSuper = true)
@Entity
@Table(name = "t_am_product_relation")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class ProductRelation extends BaseProductRelation {

    private static final long serialVersionUID = -7852204023766261917L;

    @ApiModelProperty(value = "关联关系表id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "relation_id")
    private Integer relationId;

    @Transient
    private String prodCode;

    @ApiModelProperty(value = "产品名称")
    @Transient
    private String prodName;

    @ApiModelProperty(value = "AmWorkflowDto")
    @Transient
    private String investManagerInfo;

    public Integer getRelationId() {
        return relationId;
    }

    public void setRelationId(Integer relationId) {
        this.relationId = relationId;
    }

    //重写hashCode方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ProductRelation)) return false;
        ProductRelation that = (ProductRelation) o;

        return Objects.equals(this.getRelationId(), that.getRelationId())&&
                Objects.equals(this.getProdId(), that.getProdId())
                && Objects.equals(this.getRelationType(), that.getRelationType())
                && Objects.equals(this.getRelatedId(), that.getRelatedId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getRelationId(), getProdId(),getRelatedId(),getRelationType());
    }



}


